Skip to content

feat: WidgetDemo baseline#69

Merged
ako merged 3 commits intomendixlabs:mainfrom
engalar:feat/widget-demo
Apr 6, 2026
Merged

feat: WidgetDemo baseline#69
ako merged 3 commits intomendixlabs:mainfrom
engalar:feat/widget-demo

Conversation

@engalar
Copy link
Copy Markdown
Contributor

@engalar engalar commented Apr 1, 2026

on #68

Copy link
Copy Markdown
Collaborator

@ako ako left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

This PR adds one commit on top of #68: MDL baseline scripts for a WidgetDemo module (5 files, ~717 lines of new content). All issues from PRs #66/#67/#68 carry forward.

What's new in this commit

File Lines Purpose
01-domain-model.mdl 53 3 enums, 2 entities, 1 association, security grant
01b-snippet.mdl 6 Button showcase snippet
02-showcase-page.mdl 456 95-widget showcase page
03-seed-and-navigate.mdl 98 Seed microflow + navigation grant
WIDGET_ANALYSIS.md 104 Widget classification document

Overall impression

The MDL scripts are well-structured and serve as a comprehensive integration test for the widget engine. The showcase page exercises 62 native and 33 pluggable widgets across 8 sections, which is good coverage. The scripts are self-contained (no external module dependencies).

Issues

1. Does this actually work?

The test plan checkbox "Studio Pro opens project without crash" is unchecked in PR #66 (which this stacks on), and this PR has no test plan at all. A 95-widget showcase page that depends on unreleased features from PRs #66-#68 needs validation. Has mxcli check been run against these scripts? Has the resulting project been opened in Studio Pro?

2. WIDGET_ANALYSIS.md documents known bugs without fixing them

The analysis identifies 2 "misclassified" widgets (BadgeButton, Fieldset) that DESCRIBE renders with native-style names instead of PLUGGABLEWIDGET syntax:

This is a DESCRIBE bug — the widget type mapping in customWidgetTypeShortNames produces a native-looking name.

This should be filed as an issue or fixed, not documented as known-broken in a committed analysis file.

3. Hardcoded placeholder URLs in seed data

ImageUrl = 'https://placehold.co/200x200?text=Headphones'

The seed microflow hardcodes placehold.co URLs. These are external dependencies that will break if the service goes down. For demo/test data this is probably acceptable, but worth noting — if these scripts are used in CI, the images will be broken in an air-gapped environment.

4. LanguageSelector datasource looks wrong

PLUGGABLEWIDGET '...languageselector.LanguageSelector' langSel1 (
  DataSource: DATABASE FROM WidgetDemo.DemoItem,
  languageCaption: '''en_US'''
)

A LanguageSelector backed by DemoItem entities seems semantically wrong — this widget is meant for selecting application languages, not arbitrary entities. This will likely produce a working but nonsensical widget at runtime.

5. Seed microflow uses SHOW PAGE with entity parameter

SHOW PAGE WidgetDemo.WidgetDemo_Showcase(DemoItem: $Existing);

After RETRIEVE ... LIMIT 1, if multiple items exist, only the first is passed. The page's Gallery uses a database datasource anyway (not the parameter), so the DemoItem parameter seems unnecessary for the gallery section. This works but may confuse readers about the page's data flow.

6. File naming convention

01b-snippet.mdl breaks the numeric sequence convention established by 01, 02, 03. Consider 01-domain-model.mdl, 02-snippet.mdl, 03-showcase-page.mdl, 04-seed-and-navigate.mdl — or document why the snippet must be created between domain model and page (if there's an ordering dependency).

Minor observations

  • The triple-quoted strings ('''en_US''', '''https://...''') are correct MDL escaping for strings containing single quotes — good
  • GRANT EXECUTE ON MICROFLOW and GRANT VIEW ON PAGE are properly placed after their respective CREATE statements
  • The showcase page exercises most of the new PLUGGABLEWIDGET syntax features: explicit properties, child widget slots, DataSource, TextTemplate {Param} binding, mode switching (customVisualization: true/false on Timeline)
  • WIDGET_ANALYSIS.md is useful for understanding coverage but reads more like a working document than permanent documentation — consider whether it belongs in the repo or in a PR description

Recommendation

This commit is reasonable on its own — it's focused (example scripts + analysis doc) and well-organized. However, it can't be reviewed or merged independently because it depends on the unreleased PLUGGABLEWIDGET syntax from PR #68, which in turn depends on #67 and #66. The entire 4-PR stack needs to be reviewed as a unit, which at 51K+ lines is not practical.

Suggest: resolve the issues in #66 first, then rebase the stack. Each PR should be independently mergeable.

engalar and others added 2 commits April 6, 2026 17:24
MDL baseline scripts for reproducible WidgetDemo module generation:
- 01-domain-model.mdl: 3 enums, 2 entities, 1 association
- 01b-snippet.mdl: ButtonShowcase snippet
- 02-showcase-page.mdl: 95-widget showcase (62 native, 33 pluggable)
- 03-seed-and-navigate.mdl: seed data microflow + navigation

WIDGET_ANALYSIS.md: classification of all 95 widgets by type.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove WIDGET_ANALYSIS.md (working document, not permanent docs)
- Renumber files sequentially: 01b→02, 02→03, 03→04
- Remove nonsensical LanguageSelector datasource (DemoItem entity)
@engalar engalar force-pushed the feat/widget-demo branch from bc977ca to 0b0c1c0 Compare April 6, 2026 09:26
@engalar
Copy link
Copy Markdown
Contributor Author

engalar commented Apr 6, 2026

Review Response

Rebased on updated feat/widget-engine-v2 (which is now rebased on latest main). Changes in commit 0b0c1c0.

Fixed

# Issue Fix
2 WIDGET_ANALYSIS.md committed Removed — working document, not permanent docs
4 LanguageSelector with DemoItem datasource Removed nonsensical datasource and languageCaption — widget now uses defaults
6 File naming 01b-snippet.mdl breaks convention Renumbered: 01b02, 0203, 0304

Evaluated but not changed

Item Reason
Placeholder URLs (placehold.co) Acceptable for demo scripts — these are example MDL, not CI fixtures. Added no external dependency to the build.
SHOW PAGE with DemoItem parameter The page's DataView uses DataSource: $DemoItem (line 118 in showcase page), so the parameter is required. The Gallery uses its own DATABASE datasource independently.
Validation (mxcli check / Studio Pro) Depends on PR #68 being merged first — will validate post-merge.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

AI Code Review

Critical Issues

  • Incorrect string literal syntax in videoplayer property: In mdl-examples/widgetdemo/03-showcase-page.mdl, the urlExpression property for the Videoplayer widget uses triple single quotes ('''...''') instead of proper single quotes. According to Mendix expression string escaping rules (as documented in CLAUDE.md), string literals should be enclosed in single quotes, with internal single quotes escaped by doubling them. Since the URL contains no single quotes requiring escaping, it should be: urlExpression: 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4'. The current triple-quote syntax is invalid and would cause parsing errors.

What Looks Good

  • Proper MDL syntax usage: All examples correctly follow MDL design guidelines:
    • Use standard CRUD verbs (CREATE, GRANT)
    • Employ qualified names everywhere (WidgetDemo.Module.Element)
    • Follow property format ( Key: value, ... ) with colon separators
    • Correctly distinguish colon (for properties) from AS (for name mappings - though none appear in these examples)
    • Use full English keywords with no overloading
      precated

Automated review via OpenRouter (Nemotron Super 120B) — workflow source

@engalar engalar requested a review from ako April 6, 2026 09:30
- Add CREATE MODULE and CREATE MODULE ROLE to 01-domain-model.mdl
- Add Attributes to DROPDOWNFILTER dfCat (was missing required binding)
- Replace LanguageSelector with placeholder (requires runtime config)
- Add ALTER USER ROLE to assign WidgetDemo.User to Administrator/User
- Fix dropdownfilter.def.json: attrChoice "linked" → "custom" for MDL

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 6, 2026

AI Code Review

Critical Issues

None found.

Moderate Issues

Test coverage / File placement

The PR places MDL example files in mdl-examples/widgetdemo/ but according to the project structure and checklist, doctype test files must be in mdl-examples/doctype-tests/. The checklist explicitly states:

[ ] MDL syntax changes — any PR that adds or modifies MDL syntax must include working examples in mdl-examples/doctype-tests/

While these files demonstrate existing MDL syntax rather than introducing new syntax, they serve as doctype test examples and should follow the established pattern. The existing doctype test files are numbered sequentially (01-domain-model-examples.mdl through 21-import-export-mapping-examples.mdl) and reside directly in mdl-examples/doctype-tests/.

Minor Issues

None found.

What Looks Good

MDL syntax design

All MDL example files properly follow MDL syntax guidelines:

  • Uses standard CREATE/ALTER/DROP/SHOW/DESCRIBE verbs
  • Employs qualified names everywhere (WidgetDemo.DemoItem, WidgetDemo.ENUM_Priority)
  • Property lists use correct ( Key: value, ... ) format with colon separators
  • Keywords are full English words that read as natural language
  • No keyword overloading or symbolic syntax violations
  • Statements are diff-friendly (adding properties creates one-line changes)

Code quality

  • The MDL examples are well-formatted and realistic
  • The widget definition change is a minimal, focused modification
  • Example files include appropriate comments explaining their purpose
  • No apparent duplication of existing functionality

Recommendation

Please move the WidgetDemo example files to mdl-examples/doctype-tests/ and rename them to follow the existing numbering pattern (starting at 22-). For example:

  • mdl-examples/doctype-tests/22-widgetdemo-domain-model.mdl
  • mdl-examples/doctype-tests/23-widgetdemo-snippet.mdl
  • mdl-examples/doctype-tests/24-widgetdemo-showcase-page.mdl
  • mdl-examples/doctype-tests/25-widgetdemo-seed-and-navigate.mdl

The widget definition change in sdk/widgets/definitions/dropdownfilter.def.json appears acceptable as a minor default value adjustment.

Once the file placement is corrected, this PR is ready for approval.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

@ako ako merged commit 21cfda3 into mendixlabs:main Apr 6, 2026
2 checks passed
@github-actions github-actions bot mentioned this pull request Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants